class Solution {
public:
    int maxArea(vector<int>& height) {
        int left=0;
        int right=height.size()-1;
        int m=0;
        int Max = 0;
        while(left<right)
        {
            if(height[left]<=height[right])
            {
                m=height[left]*(right-left);
                left++;
            }
            else
            {
                m=height[right]*(right-left);
                right--;
            }
            if(m>Max)
            {
                Max=m;
            }
        }
        return Max;
    }
};